package com.andre2.springboot_02;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 读取配置文件的对象并赋值
 */
@RestController
public class TestController {

    @Value("${person.name}")
    private String name;
    @Value("${person.age}")
    private Integer age;
    @Value("${person.addr}")
    private String addr;

    public TestController() {
    }

    @RequestMapping("/qiuqi")
    public String hello(){
        return "Springboot访问成功！ name:"+name+",age:"+age+",addr: "+addr;
    }
//省略get方法...
}
